import request from "@/axios/request";
import url from "@/axios/url";
const { adminUrl } = url();
//分页查询
export function getList(params = {}) {
  return request({
    url: `${adminUrl}role`,
    method: "get",
    params,
  });
}
//新增
export function rowCreate(data = {}) {
  return request({
    url: `${adminUrl}role`,
    method: "post",
    data,
  });
}
//修改
export function rowUpdate(data = {}) {
  return request({
    url: `${adminUrl}role`,
    method: "put",
    data,
  });
}
//删除
export function rowDel(id) {
  return request({
    url: `${adminUrl}role/${id}`,
    method: "delete",
  });
}
//资源树形菜单集合
export function getTreeList() {
  return request({
    url: `${adminUrl}resource/tree`,
    method: "get",
  });
}
// 分配资源
export function setResource(data) {
  return request({
    url: `${adminUrl}role/resource`,
    method: "put",
    data,
  });
} // 获取角色资源
export function getResource(id) {
  return request({
    url: `${adminUrl}resource/tree/${id}`,
    method: "get",
  });
}
